/**
 * Copyright (C), 2015-2021, XXX有限公司
 * FileName: InterceptorConfig
 * Author:   杨朝湖
 * Date:     2021/3/24 0024 22:23
 * Description:
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.gym.jurisdiction;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * 〈一句话功能简述〉<br>
 * 〈〉
 *
 * @author 杨朝湖
 * @create 2021/3/24 0024
 * @since 1.0.0
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Bean
    public HandlerInterceptor getHandlerInterceptor() {
        return new AuthenticationInterceptor();
    }

    @Resource
    private AuthenticationInterceptor authenticationInterceptor;

    /**
     * 拦截器配置
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 权限校验拦截器配置
        registry.addInterceptor(authenticationInterceptor)
                // 配置全部路径拦截
                .addPathPatterns("/**");
    }
}

